﻿using PoemGame.Domain.Seedwork;

namespace PoemGame.Domain.GameAggregate
{
    public class PlayRecord:ValueObject
    {

        private PlayRecord()
        {

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="gameId"></param>
        /// <param name="playerId"></param>
        /// <param name="playerName"></param>
        /// <param name="playDateTime"></param>
        /// <param name="answer"></param>
        /// <param name="isProperAnswer"></param>
        public PlayRecord(Guid gameId, Guid playerId, string playerName, DateTime playDateTime, string answer, bool isProperAnswer)
        {
            GameId = gameId;
            PlayerId = playerId;
            PlayerName = playerName;
            PlayDateTime = playDateTime;
            Answer = answer;
            IsProperAnswer = isProperAnswer;

        }

        /// <summary>
        /// 游戏ID
        /// </summary>
        public Guid GameId { get; private set; }
        /// <summary>
        /// 玩家ID
        /// </summary>
        public Guid PlayerId { get; private set; }
        /// <summary>
        /// 玩家用户名
        /// </summary>
        public string PlayerName { get; private set; }
        /// <summary>
        /// 进行时间
        /// </summary>
        public DateTime PlayDateTime { get; private set; }
        /// <summary>
        /// 回答
        /// </summary>
        public string Answer { get; private set; }
        /// <summary>
        /// 回答是否合适
        /// </summary>
        public bool IsProperAnswer { get; private set; }

        protected override IEnumerable<object> GetEqualityComponents()
        {
            yield return PlayerId;
            yield return GameId;
            yield return PlayerName;
            yield return PlayDateTime;
            yield return Answer;
            yield return IsProperAnswer;
        }
    }
}
